//
//  ThemeManager.swift
//  主题切换
//
//  Created by 王帅强 on 2019/1/14.
//  Copyright © 2019 王帅强. All rights reserved.
//

import UIKit


let ThemeNotifacationName = NSNotification.Name("keyThemeNotifacation")

class ThemeManager: NSObject {
    static let share = ThemeManager()

    var theme: ThemeProtocol = WhiteTheme()

    static func changeTheme(type: ThemeType) {
        ThemeManager.share.changeTheme(type: type)
    }


    private func changeTheme(type: ThemeType) {
        self.theme = type.theme
        NotificationCenter.default.post(name: ThemeNotifacationName, object: self.theme)
    }
}
